package com.module.admin.controller;

import com.module.admin.Warpper.ProductWarpper;
import com.module.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by asus on 2018/7/1.
 */
@Controller
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private GoodsService goodsService;
    private static String PREFIX = "/back/system/good/";
    @RequestMapping("")
    public String index(){
        return PREFIX+"good.btl";
    }

    @RequestMapping("/list")
    @ResponseBody
    public Object list(@RequestParam(required = false) String describe) {
        return new ProductWarpper(goodsService.list(describe)).warp();
    }
    @RequestMapping("/test")
    public String test(){
        return PREFIX+"category.btl";
    }


}
